package com.sc.nft.admin.rpc;

import com.sc.nft.admin.request.*;
import com.sc.nft.annotation.SysMemberLogin;
import com.sc.nft.dao.DigitalCollectionDao;
import com.sc.nft.dto.DigitalCollectionDTO;
import com.sc.nft.dto.SimpleDigitalCollectionDTO;
import com.sc.nft.entity.DigitalCollection;
import com.sc.nft.entity.vo.EcologyCollectionCountVO;
import com.sc.nft.entity.vo.EcologySmeltVO;
import com.sc.nft.entity.vo.EcologyTeamDataVO;
import com.sc.nft.entity.vo.ecology.*;
import com.sc.nft.service.AdminEcologyHatchConfService;
import com.sc.nft.sup.PageResult;
import com.sc.nft.sup.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import javax.validation.Valid;
import java.util.List;

@Slf4j
@RequiredArgsConstructor
@RestController
@RequestMapping("/rpc/user/ecology/smelting")
@Api(tags = "后台生态熔炼配置管理")
public class EcologySmeltingConfRpc {

    private final AdminEcologyHatchConfService adminEcologyHatchConfService;

    @PostMapping(value = "/userRecords", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "用户熔炼记录列表", notes = "用户熔炼记录列表", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiIgnore
    PageResult<AdminUserEcologyHatchRcordsVO> userRecords(@Valid @RequestBody UserEcologyHatchRcordsReuqest request) {
        return PageResult.success(adminEcologyHatchConfService.userRecords(request.getDaoUserId(),request.getDaoId(),
                request.getCollectionName(),request.getUserTel(),request.getStartTime(),request.getEndTime(),request.getPageNo(),request.getPageSize(),request.getMethodName()));
    }


    @PostMapping(value = "/userRecordsDetails", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "用户熔炼记录详情", notes = "用户熔炼记录详情", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiIgnore
    public Result<List<AdminUserEcologyHatchRcordsDetailsVO>> userRecordsDetails(@Valid @RequestBody IdRequest request) {
        return Result.success(adminEcologyHatchConfService.userRecordsDetails(request.getId()));
    }

    @PostMapping(value = "/getPageUserRecordsRecords", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "用户熔炼记录奖励", notes = "用户熔炼记录奖励", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiIgnore
    public PageResult<AdminPageUserRewardsRecordsVO> getPageUserRecordsRecords(@Valid @RequestBody AdminPageUserRecordsRecordsRequest request) {
        return PageResult.success(adminEcologyHatchConfService.getPageUserRecordsRecords(request.getId(),request.getStartTime(),request.getEndTime(),request.getPageNo(),request.getPageSize()));
    }

    @PostMapping(value = "/userEcologyCollectionRecords", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "熔炼详情消耗藏品记录", notes = "熔炼详情消耗藏品记录", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiIgnore
    public Result<List<UserEcologyCollectionRecordsVO>> userEcologyCollectionRecords(@Valid @RequestBody IdRequest request) {
        return PageResult.success(adminEcologyHatchConfService.userEcologyCollectionRecords(request.getId()));
    }

    @PostMapping(value = "/getPageTeamHatchData", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "团对熔炼数据", notes = "团对熔炼数据", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiIgnore
    public Result<AdminTeamHatchDataVO> getPageTeamHatchData(@Valid @RequestBody PageTeamHatchDataRequest request) {
        return Result.success(adminEcologyHatchConfService.getPageTeamHatchData(request.getDaoUserId(),request.getId(),request.getUserTel(),request.getStartTime(),request.getEndTime()));
    }

    @PostMapping(value = "/ecologyCollectionCount", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "生态藏品铸造/重铸数量", notes = "生态藏品铸造/重铸数量", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiIgnore
    public Result<List<EcologyCollectionCountVO>> ecologyCollectionCount(@Valid @RequestBody IdRequest request) {
        return Result.success(adminEcologyHatchConfService.ecologyCollectionCount(request.getId()));
    }

    @PostMapping(value = "/ecologySmeltCount", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "生态熔炼数据", notes = "生态熔炼数据", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiIgnore
    public Result<List<EcologySmeltVO>> ecologySmeltCount(@Valid @RequestBody TimeIdRequest request) {
        return Result.success(adminEcologyHatchConfService.ecologySmeltCount(request.getId(),request.getStartTime(),request.getEndTime()));
    }
    @PostMapping(value = "/ecologySmeltTeam", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiOperation(value = "生态熔炼团队数据", notes = "生态熔炼团队数据", httpMethod = "POST", produces = MediaType.APPLICATION_JSON_VALUE)
    @ApiIgnore
    public Result<List<EcologyTeamDataVO>> ecologySmeltTeam(@Valid @RequestBody PhoneIdRequest request) {
        return Result.success(adminEcologyHatchConfService.ecologySmeltTeam(request.getId(),request.getPhoneNo()));
    }
}
